patches

 

Patches reports the agentset of all patches in a model, while patch reports a specific patch. They are commonly used to command the patches to do something in an ask patches [ ... ] context. To report a specific patch, use patch x y, for example ask patch 2 -3 [set pcolor green] would set the patch with an x-coordinate of 2 and a y-coordinate of -3 to green, while ask patches [ set pcolor green ] would change all of the patches in the model to green.

 

Try it Yourself

 
 
 
 
 
 
 

What's next?

Once you mastered the patches primitive, don't stop there. Check out the resources below to improve your NetLogo skills.

 
Published NetLogo models that use the patches primitive:
 
 
Similar primitives:
clear-patches

clears the patches by resetting all patch variables to their default initial values

Read more
patches-own

Declare a variable that belongs to patches.

Read more
neighbors

reports an agentset containing eight neighboring patches

Read more
move-to

allows a turtle to set its x and y coordinates to be the same as another turtle or patch

Read more
 
Learn another primitive